package com.spider.gui2;

import javax.swing.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

//自定义的登录界面，认JFrame做父类
public class LoginFrame extends JFrame implements ActionListener {
    public LoginFrame() {
       this.setTitle("登录界面");
       this.setSize(400, 300);
       this.setLocationRelativeTo(null);
       this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
       init();
    }

    private void init() {
        //添加一个登录按钮
        JButton btn = new JButton("登录");
        btn.addActionListener(this);
        JPanel panel = new JPanel();
        this.add(panel);
        panel.add(btn);
    }

    @Override
    public void actionPerformed(ActionEvent e) {
        JOptionPane.showMessageDialog(this, "点击了登录按钮");
    }
}
